<?php
include('../incsession.php');
if(isset($_POST['level'])){
	$query = "SELECT aid FROM article WHERE topicid=".$_SESSION['topic']." AND level=".$_POST['level'];
	$result = mysql_query($query,$orcp_con) or die ('Error in query');
	$row = mysql_fetch_row($result);
	$_SESSION['level']=$_POST['level'];
	$_SESSION['aid'] = $row[0];
	header("location: abstract.php");
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>選擇難度</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>

<body onLoad="TimeCountDown()">
<div id="wrapper">
	<div id="header">
		<div id="logo"></div>
		<div id="menu">
        <?php
			include("menu.php");
		?>
       
		</div>
	</div>
	<div class="clearer"></div>
	<div class="edge-top"></div>

	<div id="main">

		<div id="title">標題在這裡<font size=4><br>請選擇想要學習的難度</font></div>
<hr/><br><br>

<!-- 內文開始 !-->



<form method = POST action = 'level.php'>
<Input type = 'Radio' Name ='level' value= '1'
<?php
$flag=0;
$query = "SELECT * FROM score WHERE topicid=".$_SESSION['topic']." AND classid=".$_SESSION['class']." AND level=1";
$result = mysql_query($query,$orcp_con) or die ('Error in query');
if(mysql_num_rows($result)!=0)
	echo " disabled";
else{
	echo " checked";
	$flag=1;
} 

?>
>&nbsp;簡單 (easy)
<br><br>
<Input type = 'Radio' Name ='level' value= '2'
<?php
$query = "SELECT * FROM score WHERE topicid=".$_SESSION['topic']." AND classid=".$_SESSION['class']." AND level=2";
$result = mysql_query($query,$orcp_con) or die ('Error in query');
if(mysql_num_rows($result)!=0)
	echo " disabled";
else{
	if($flag!=1)
		echo " checked";
}
?>
>&nbsp;中等 (intermediate)
<br><br>
<Input type = 'Radio' Name ='level' value= '3'
<?php
$query = "SELECT * FROM score WHERE topicid=".$_SESSION['topic']." AND classid=".$_SESSION['class']." AND level=3";
$result = mysql_query($query,$orcp_con) or die ('Error in query');
if(mysql_num_rows($result)!=0)
	echo " disabled";
else{
	if($flag!=1)
		echo " checked";
}
?>
>&nbsp;困難 (difficult)
<br><br>
<div class="btn_right"><Input type = "Submit" Name = "next_page" Value = "下一步 >> 閱讀摘要"></div>
</form>
<!-- 內文結束 !-->

	</div>
    <div class="edge-bottom"></div>
    <div id="footer"><?php  include("footer.php"); ?></div>
</div>


<!--
<div id="association">&nbsp;association</div>
<div id="voc_cart">&nbsp;vocabulary cart</div> 
!-->
</body>
</html>